As the software market grows, requirements for software applications become more diverse and complex, which means that the scope of use and complexity of the applications also increase. Quality requirements need to be changed depending on each instance of use during execution because each user varies its own desires. Therefore, an application must contain different functions to suit different users' requirements. For example, if user $A$ has more concerns about security, then the application would sacrifice usability and add more security functions to achieve a more secure execution, while if user $B$ desires faster execution, the application would sacrifice usability and security by removing rich user interfaces and secure authentication functions.

The changing environments in which applications perform their tasks further complicate the problem. Examples of situation variance are changes in position, noise, light, battery level, and network bandwidth. These factors can change the quality of applications. Therefore, the applications must modify their functionality in response to situational changes. For example, if there is considerable background noise in an environment, a notification application in mobile devices would likely change its alarm function from ``Sound Alarm'' to ``Vibration Alarm.''

The abovementioned examples describe the dynamic architectural selection problem. This problem is a combinatorial optimization problem that maximizes user concerns by searching for the best combination satisfying the user. In the dynamic architectural selection problem, architectural instances shape the search space (i.e., combinations). An architectural instance is represented by a combination of architectural decision variables that constitute an architectural configuration of an application.

In case of a small number of architectural instances, situations, and requirements changes, the dynamic architectural selection problem can be solved during development time by mapping the best architectural instance for every situational and requirements change (the best architectural instance for each change can be found by using the exhaustive search method). However, in case of a large number of them, it requires a very long time to search for the best architectural instance using the exhaustive search.

In addition, mapping the best architectural instance during development time is not applicable if changes in situations and requirements cannot be determined prior to runtime. This implies that specific values of situations and requirements can be monitored only at runtime. Therefore, the best architectural instance for them should be dynamically determined at runtime.
%[j] mapping the best architectural instance into each change?

This problem has been recognized as an important research challenge in dynamically adaptable application development and has already issued in several studies. Jaaksi \cite{DBLP:journals/software/Jaaksi02} discussed architectural selection in developing mobile applications (mobile browsers) and mentioned concerns related to the selection. Hallsteinsen \emph{et al.} \cite{madam,DBLP:conf/splc/HallsteinsenSSF06} provided a utility-based approach to architectural selection in mobile applications at runtime. Zhang and Jarzabek \cite{DBLP:conf/splc/ZhangJ05} introduced diverse alternative components for mobile games discussed the selection. White and Schmidt \cite{white2008} also emphasized functionality selection in mobile applications and provided some examples of alternative functionality.

However, existing approaches to architectural selection focus on static and brute-force selection. Static selection (i.e., static binding) during development may lead to low adaptability in environments characterized by rapidly changing situations and requirements. Brute-force selection (applied in \cite{madam,DBLP:conf/splc/HallsteinsenSSF06}) may lead to a very long selection time as the number of architectural instances increases (the search space for possible combinations, which are architectural instances, may exponentially increase; this is discussed in \cite{DBLP:conf/pfe/MannionC03}). In other words, brute force selection may have scalability problems when there is a large number of architectural instances. Therefore, it is necessary to provide a dynamic and efficient selection method to adapt software applications in response to changes in situations and requirements.

%and to rapidly respond to the changes in mobile environments.

%To handle the complex structure and changing environments, previous studies took advantage of adaptive software architectures\cite{JEFFS2007}. These studies attempted to dynamically reconfigure software architectural configurations using utility functions\cite{madam}, prescribed architectural reconfiguration scripts\cite{rainbow,1075420}, and architectural models\cite{582134}. However, these approaches are limited to the architectural changes prescribed by developers and handled by manual planning rather than autonomous architectural reconfiguration in response to immediate user requirement changes and a large number of situational changes.

The goal of this study is to provide a method that dynamically and rapidly selects an appropriate architectural instance from a large set of candidates in response to changes in situations and requirements at runtime. To describe this problem, we provide a motivating example that illustrates how software architecture must be changed when situations and requirements change. Then, we precisely formulate the architectural selection problem using softgoal interdependency graphs. To deal with this problem, this paper provides a novel approach to dynamic architectural selection using genetic algorithms. This approach enables a software application to dynamically reconfigure its architectural configuration in a manner that satisfies the current situation and user requirements within a short amount of time even if the application has a large number of candidate architectural instances. Further, this selection process attempts to find a near-optimal architectural instance for the situations and requirements.

% contribution?
From a technical standpoint, this paper makes the following contributions:
\begin{enumerate}
    \item We present a novel method to select an appropriate architectural configuration in response to changes in situations and quality requirements at runtime.
    \item We evaluate our approach on existing systems.
    \item We show that our approach is \emph{efficient,} as it precisely and rapidly selects architecture configurations compared to other approaches.
\end{enumerate}

The remainder of this paper is organized as follows: The next section provides a motivating example that requires dynamic architectural selection at runtime. Section \ref{sec:approach} describes our approach that formulates the architectural selection problem based on softgoal interdependency graphs (Section~\ref{sec:formulation}) and proposes a genetic algorithm-based approach to dynamic architectural selection on the basis of the formulation (Section~\ref{sec:genetic}). Section \ref{sec:eval} evaluates the proposed approach in terms of effectiveness and efficiency. Section \ref{sec:diss} discusses several issues related to the proposed approach. Section \ref{sec:relatedwork} compares the proposed approach to related work. Finally, Section \ref{sec:con} concludes the paper and proposes possible future work.

